import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class FinanceOldchangeManageService {

  serviceUrls: any = {
    queryOrderChangeListUrl: '/renewalRecord/list', // 查询List
    updateCollectionInfosUrl: '/renewalRecord/update', // 编辑收款信息
    paymentUrl: '/renewalRecord/payment', // 打款
    generateSubsidiesUrl: '/renewalRecord/subsidy', // 生成补贴
    exportFindExcelUrl: '/renewalRecord/findExcel' // 导出
  };

  constructor(public httpClient: HttpClient) { }
  
  // 查询List
  getOrderChangeListData(params: any) {
    return this.httpClient.post(this.serviceUrls.queryOrderChangeListUrl, params).toPromise();
  }

  // 编辑收款信息
  updateCollectionInfosData(params: any) {
    return this.httpClient.post(this.serviceUrls.updateCollectionInfosUrl, params).toPromise();
  }

  // 打款
  paymentData(params: any) {
    return this.httpClient.post(this.serviceUrls.paymentUrl, params).toPromise();
  }

  // 生成补贴
  generateSubsidiesData(params: any) {
    return this.httpClient.post(this.serviceUrls.generateSubsidiesUrl, params).toPromise();
  }

  // 以旧换机导出
  exportFindExcelData(params: any) {
    return this.httpClient.get(this.serviceUrls.exportFindExcelUrl, { params, responseType: 'blob' }).toPromise();
  }
}



